<!DOCTYPE html>
<html lang="en">
{% load static %}
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
{#    <link rel="stylesheet" href="/static/login/index.css">#}
    <link rel="stylesheet" href="{% static '/login/index.css' %}">

</head>

<body>
    <!-- 整体 -->
    <div class="container right-panel-active">
        <!-- 注册 -->
        <div class="container_from container--signin">
            <form action="{% url 'register' %}" method="post" class="from" id="from1">
                <h2 class="from_title">注册</h2>
                {% csrf_token %}
                <input type="text" placeholder="请输入用户名" oninput="setCustomValidity('')" onblur="checkUsername1()" class="input" id="reg_username" required name="user_name"/><span class="imsg" id="userPassword">请输入用户名</span>
                <input type="email" placeholder="请输入邮箱" oninput="setCustomValidity('')" onblur="checkUseremail()" class="input" id="reg_uemail" required name="email"/><span class="imsg" id="userPassword">请输入邮箱</span>
                <input type="txt" placeholder="请输入手机号" class="input" id="phone" required name="phone"/><span class="imsg" id="phone">请输入手机号</span>
                <input type="password" placeholder="请输入密码" onblur="password_verify()" oninput="setCustomValidity('')" name="password" class="input" id="password2" required />
                <button class="btn">注册</button>
            </form>
        </div>

        <!-- 登录 -->
        <div class="container_from container--signup">
            <form action="{% url 'login' %}" method="POST" class="from" id="from2">
                <h2 class="from_title">登录</h2>
                {% csrf_token %}
                <input type="text" placeholder="请输入用户名" required class="input" id="inun" name="user_name"/> <span class="imsg" id="inUserName">请输入用户名</span>
                <input type="password" placeholder="请输入密码" required class="input" id="inupwd" name="password"/>
                <span style="font-size: 15px;color: red;margin: 10px">{{ msg }}</span>
{#                <a href="javascript:void(0)"  data-toggle="modal" data-target="#myModal" class="link">忘记密码?</a>#}
                <input class="btn" type="submit" value="登录"></input>
            </form>
        </div>
        <!-- 遮罩层 -->
        <div class="container-overlay">
            <div class="overlay">
                <div class="overlay_panel overlay-left">
                    <button class="btn" id="signin">已有账号，直接登录</button>
                </div>

                <div class="overlay_panel overlay-right">
                    <button class="btn" id="signup">没有账号，点击注册</button>
                </div>
            </div>
        </div>
    </div>


    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
		<div class="modal-content">

			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					忘记密码
				</h4>
			</div>
{#            <form action="{% url 'senemail' %}" method="post">#}
{#			<div class="modal-body">#}
{#                <div style="margin-bottom: 1%">#}
{#				<input style="border-style: solid;border-width: thin;width: 70%" type="email" placeholder="请输入邮箱" oninput="setCustomValidity('')" onblur="checkUseremail2()" class="input" id="yanzhen_uemail" required name="email"/><span class="imsg" id="">请输入邮箱</span>#}
{#			    <a href="javascript:void(0)" id="a_yanzhen" onclick="yanzheng()" style="position: relative;right: 7%">免费获取验证码</a>#}
{#                <input id="a_yanzhen" onclick="yanzheng()" style="position: relative;right: 7%" value="免费获取验证码">#}
{#                </div>#}
{#                <input style="border-style: solid;border-width: thin;margin-bottom: 1%;" type="text" onclick="verfiy()" placeholder="请输入验证码" oninput="setCustomValidity('')"  class="input" id="code" required name="code"/>#}
{#                <input style="border-style: solid;border-width: thin;" type="text" placeholder="请输入新密码" oninput="setCustomValidity('')"  class="input" id="newpwd" required name="newpwd"/>#}
{#            </div>#}
{#			<div class="modal-footer">#}
{#				<button type="button" class="btn btn-default" data-dismiss="modal">关闭#}
{#				</button>#}
{#				<button type="submit" class="btn btn-primary">#}
{#					确认修改#}
{#				</button>#}
{#			</div>#}
{#            </form>#}
		</div><!-- /.modal-content -->
    </div>

{#    <script src="/static/login/index.js"></script>#}
{#    <script src="/static/index/jquery-1.11.0.js"></script>#}
        <script src="{% static '/login/index.js' %}"></script>
        <script src="{% static '/index/jquery-1.11.0.js' %}"></script>
</body>
<script>


    {#function checkUsername1(){#}
    {#    user_name = document.getElementById("reg_username");#}
    {#    console.log(user_name.value);#}
    {#    $.ajax({#}
    {#        url:'{% url 'selectUsername' %}',#}
    {#        type:'get',#}
    {#        cache:false,#}
    {#        async:false,#}
    {#        data:{'username':user_name.value},#}
    {#        success:function(data){#}
    {#            var user_name = document.getElementById("reg_username");#}
    {#            if(data=='1'){#}
    {#                user_name.setCustomValidity("用户名已被注册");#}
    {#                user_name.oninvalid();#}
    {#            }else{#}
    {#                user_name.setCustomValidity('');#}
    {#            }#}
    {##}
    {#        },#}
    {#        error:function(e){#}
    {#            console.log(e);#}
    {#        }#}
    {#    });#}
    {# }#}
    {##}
    {#function checkUseremail(){#}
    {#    var email = document.getElementById("reg_uemail");#}
    {#    console.log(email.value);#}
    {#    $.ajax({#}
    {#        url:'{% url 'selectEmail' %}',#}
    {#        type:'get',#}
    {#        cache:false,#}
    {#        async:false,#}
    {#        data:{email:email.value},#}
    {#        success:function(data){#}
    {#            var email = document.getElementById("reg_uemail");#}
    {#            if(data=='1'){#}
    {#                email.setCustomValidity("油箱已被注册");#}
    {#                email.oninvalid();#}
    {#            }else{#}
    {#                email.setCustomValidity('');#}
    {#            }#}
    {##}
    {#        },#}
    {#        error:function(e){#}
    {#            console.log(e);#}
    {#        }#}
    {#    });#}
    {# }#}
    {#function checkUseremail2(){#}
    {#    var email = document.getElementById("yanzhen_uemail");#}
    {#    console.log(email.value);#}
    {#    $.ajax({#}
    {#        url:'{% url 'selectEmail' %}',#}
    {#        type:'get',#}
    {#        cache:false,#}
    {#        async:false,#}
    {#        data:{email:email.value},#}
    {#        success:function(data){#}
    {#            var email = document.getElementById("yanzhen_uemail");#}
    {#            if(data=='1'){#}
    {#                email.setCustomValidity("");#}
    {#            }else{#}
    {#                email.setCustomValidity('油箱未被注册');#}
                    {#email.oninvalid();#}
    {#            }#}
    {#        },#}
    {#        error:function(e){#}
    {#            console.log(e);#}
    {#        }#}
    {#    });#}
    {# }#}
    {#function password_verify() {#}
    {#    var pass1 = document.getElementById("password1");#}
    {#    var pass2 = document.getElementById("password2");#}
    {#    if (pass1.value != pass2.value){#}
    {#        pass2.setCustomValidity('两次密码不一致');#}
    {#        pass2.oninvalid();#}
    {#    }else{#}
    {#        pass2.setCustomValidity('');#}
    {#        }#}
    {#    }#}
    {#var daojishi = 0;#}
    {#    #}
    {#function yanzheng(){#}
    {#    var email = document.getElementById("yanzhen_uemail");#}
    {#    if(daojishi == 0){#}
    {#        $.ajax({#}
    {#            url:'{% url 'selectEmail' %}',#}
    {#            type:'get',#}
    {#            cache:false,#}
    {#            async:false,#}
    {#            data:{email:email.value},#}
    {#            success:function(data){#}
    {#                if(data=='1'){#}
    {#                    $.ajax({#}
    {#                        url:'{% url 'senemail' %}',#}
    {#                        type:'get',#}
    {#                        data:{#}
    {#                            'email':email.value#}
    {#                        },#}
    {#                        success:function (data) {#}
    {#                        }#}
    {#                    });#}
    {#                    daojishi = 1;#}
    {#                    var wait=60;#}
    {#                    time(document.getElementById("a_yanzhen"),wait);#}
    {#                    function time(o) {#}
    {#                         if (wait == 0) {#}
    {#                             o.removeAttribute("disabled");#}
    {#                             o.innerHTML="免费获取验证码";#}
    {#                             wait = 60;#}
    {#                         } else {#}
    {#                             o.setAttribute("disabled", true);#}
    {#                             o.innerHTML="重新发送(" + wait + ")";#}
    {#                             wait--;#}
    {#                             if (wait==0){#}
    {#                                 daojishi = 0;#}
    {#                             }#}
    {#                         setTimeout(function() {#}
    {#                         time(o)#}
    {#                         },#}
    {#                         1000)#}
    {#                         }#}
    {#                    }#}
    {#                }else{#}
    {#                    alert('油箱未被注册');#}
    {#                    email.setCustomValidity('油箱未被注册');#}
    {#                }#}
    {#            },#}
    {#            error:function(e){#}
    {#                console.log(e);#}
    {#            }#}
    {#        });#}
    {#    }#}
    {# }#}
    {##}
    {#function verfiy() {#}
    {#    var email = document.getElementById("yanzhen_uemail");#}
    {#    var code = document.getElementById("code");#}
    {#    $.ajax({#}
    {#        url:'{% url 'verfiy' %}',#}
    {#        type:'post',#}
    {#        data:{#}
    {#            'email':email.value,#}
    {#            'code':code.value#}
    {#        },#}
    {#        success:function (data) {#}
    {#            console.log(data);#}
    {#            if (data != '200'){#}
    {#                code.setCustomValidity('验证码输入有误');#}
    {#            }else{#}
    {#                code.setCustomValidity('');#}
    {#            }#}
    {#        }#}
    {#    });#}
    {# }#}



</script>
</html>